Skip to content

[Dev] Fix full CUDA graph capture reverted by pull main#4792

Merged
yaox12 merged 1 commit into
NVIDIA:devfrom
Victarry:denliu/fix-cu-seqlens-cuda-graph-capture
May 19, 2026
Merged

[Dev] Fix full CUDA graph capture reverted by pull main#4792
yaox12 merged 1 commit into
NVIDIA:devfrom
Victarry:denliu/fix-cu-seqlens-cuda-graph-capture

Conversation

@Victarry

@Victarry Victarry commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore the source-rank cu_seqlens length broadcast allocation to torch.empty(1, dtype=torch.int64, device=dev).fill_(n).
  • Avoid torch.tensor(n, dtype=torch.int64, device=dev), which can perform a CPU-to-CUDA copy and fails during full-iteration CUDA graph capture when the CPU source is not pinned.
  • This restores the earlier dev behavior from f9f9fe415 (Add minor tweaks to support full-iter CG capture). The nightly pull-main chore: nightly sync main into dev (10_05_2026) #4716 post-merge commit cd2001de7 (chore: post-merge fixes for nightly sync main into dev (28_04_2026)) took main's megatron/training/utils.py and reverted this line back to torch.tensor(...).

Test plan

  • python -m py_compile megatron/training/utils.py
  • CHECK_ONLY=true BASE_REF=dev uv run --project /Users/denliu/Projects/repos/agentic-mcore-dev --extra mcore-lint -- bash tools/autoformat.sh
  • Copyright check: no megatron/core or tests Python files changed.
  • Ran paged-stash dev config on Computelab B300 (umb-b300-003) with local/b300-cudnnfe1221:latest; reached iteration 100, printed validation loss, and no longer hit the CUDA graph capture error from torch.tensor(n, device=dev).

@Victarry Victarry requested review from a team as code owners May 14, 2026 02:48
@copy-pr-bot

copy-pr-bot Bot commented May 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Victarry Victarry changed the title [Dev] Fix cu_seqlens broadcast CUDA graph capture [Dev] Fix full CUDA graph capture reverted by pull main May 14, 2026
@Victarry

Copy link
Copy Markdown
Contributor Author

/ok to test 05fc772

@Victarry Victarry added this pull request to the merge queue May 15, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/25895642818

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 15, 2026
@yaox12 yaox12 added this pull request to the merge queue May 19, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/26072372181

Merged via the queue into NVIDIA:dev with commit fad6c1e May 19, 2026
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants